<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body layadmin-themealias="default">

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15="">
                    <div class="layui-form" wid100="" lay-filter="">
                        <input type="hidden" name="id" value="{$manager_info.id}">
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="mobile" value="{$manager_info.mobile}" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">登录密码</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" placeholder="不填写则不修改密码" value="" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">真实姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="real_name" value="{$manager_info.real_name}" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item {$manager_info.role_id<3?'layui-hide':''}">
                            <label class="layui-form-label">分成比例</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sharing_ratio" value="{$manager_info.sharing_ratio}" class="layui-input">
                            </div>
                        </div>

                        <!--&lt;!&ndash;超管和管理员不让修改下面两项&ndash;&gt;-->
                        <!--{if $manager_info.role_id>2}-->

                        <!--{eq name='hight_auth' value='1'}-->
                        <!--<div class="layui-form-item">-->
                        <!--    <label class="layui-form-label">账号类型</label>-->
                        <!--    <div class="layui-input-block">-->
                        <!--        <input type="radio" name="account_type" value="1" title="管理员"/>-->
                        <!--        <input type="radio" name="account_type" value="2" checked title="经纪人"/>-->
                        <!--    </div>-->
                        <!--</div>-->
                        <!--{/eq}-->

                        <!--<div class="layui-form-item">-->
                        <!--    <label class="layui-form-label">直属上级</label>-->
                        <!--    <div class="layui-input-inline">-->
                        <!--        <select name="parent_id" lay-verify="required">-->
                        <!--            <option value="0">请选择直属上级</option>-->
                        <!--            {volist name="manager_list" id="item"}-->
                        <!--            <option value="{$item.id}" {$manager_info.parent_id==$item.id?'selected':''}>{$item.real_name}（{$item.role.name}）</option>-->
                        <!--            {/volist}-->
                        <!--        </select>-->
                        <!--    </div>-->
                        <!--</div>-->
                        <!--{/if}-->
                        <div class="layui-form-item">
                            <div class="layui-input-block text-center">
                                <button class="layui-btn" lay-submit="" lay-filter="guild-manager-edit">确认保存</button>
                                <button class="layui-btn layui-btn-primary" id="close">取消</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

{include file='index/common' /}

<script src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'tree', 'admin', 'guild/manager'], function () {
        var $ = layui.$
            , form = layui.form
            , admin = layui.admin;

        var index = parent.layer.getFrameIndex(window.name);

        $('#close').on("click", function () {
            parent.layer.close(index);
        });

        form.on('submit(guild-manager-edit)', function (obj) {
            if (obj.field.parent_id == 0) {
                layer.msg('请选择角色', {icon: 5});
                return;
            }
            //提交
            admin.req({
                url: '{:url("manager/edit_post")}'
                , data: obj.field
                , type: 'post'
                , success: function (res) {
                    if (res.code == 0) {
                        parent.layer.close(index);
                        parent.layer.msg(res.msg, {icon: 1}, function () {
                            location.reload();
                        });
                        parent.layui.table.reload('LAY-guild-manager');
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
